package zhr.chapter4.example2;

public class Point {
    int x,y;
    String name = "apoint";
    Point(){
        int x=0;
        int y=0;
    }
    Point(int x,int y,String name){
        this.x=x;
        this.y=y;
        this.name=name;
    }
    int getX(){
        return x;
    }
    int getY(){
        return y;
    }
    void move(int newX,int newY){
        x=newX;
        y=newY;
    }
    Point newPoint(String name){
        Point newP=new Point(-x,-y,name);
        return newP;
    }
    boolean equal(int x,int y){
        if(this.x==x&&this.y==y){
            return true;
        }else {
            return false;
        }
    }
    void print(){
        System.out.println(name+":x="+x+"y="+y);
    }

}
